package ProjectTeam39.Networking;
import ProjectTeam39.Domains.*;

public class AppointmentCalenderMessage extends Message{
	private static final long serialVersionUID = 1L;
	
	Message.MessageType type;
	
	public AppointmentCalenderMessage(Object c, Message.MessageType type){
		super(c);
		this.type = type;
	}
	
	public Message handle(final Model model){
		Message m = null;
		if(type==Message.MessageType.REQUEST){
			m = new AppointmentCalenderMessage(model.getAppointmentCalender(), Message.MessageType.RETURN);
		}
		else{
			// if (type==Message.MessageType.UPDATE)
			model.setAppointmentCalender((AppointmentCalender)super.getContents());
			m = new AppointmentCalenderMessage(null, Message.MessageType.RETURN);
		}
		return m;
	}
}
